package com.green.controller;

import com.green.service.ExcelReadService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/read")
@AllArgsConstructor
public class ReadController {

    private final ExcelReadService excelReadService;

    @PostMapping("demo1")
    public void read(@RequestParam("file") MultipartFile file) {
        excelReadService.readSimpleExcel(file);
    }

    @PostMapping("demo2")
    public void read2(@RequestParam("file") MultipartFile file) {
        excelReadService.readSimpleExcel2(file);
    }

    @PostMapping("demo3")
    public void readMultiSheetExcel(@RequestParam("file") MultipartFile file) {
        excelReadService.readMultiSheetExcel(file);
    }

    @PostMapping("demo4")
    public void readMultiHeadExcel(@RequestParam("file") MultipartFile file) {
        excelReadService.readMultiHeadExcel(file);
    }

        @PostMapping("demo5")
    public void readByConverterData(@RequestParam("file") MultipartFile file) {
        excelReadService.readByConverterData(file);
    }
}
